local thbattle__ailisi_renoubaodan = fk.CreateSkill {

  name = "thbattle__ailisi_renoubaodan",

  tags = {  },

}



thbattle__ailisi_renoubaodan:addEffect(fk.AfterCardsMove, {
  name = "thbattle__ailisi_renoubaodan",
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(thbattle__ailisi_renoubaodan.name) then
      for _, move in ipairs(data) do
        if move.proposer~=nil and move.proposer ~= player and not move.proposer:isNude()
            and move.from and move.from == player and
            ((move.to and move.to ~= player) or (move.to == nil and (move.toArea == Card.DiscardPile or move.toArea == Card.Processing))) then
          for _, info in ipairs(move.moveInfo) do
            if info.fromArea == Card.PlayerEquip then
              event:setCostData(self, move.proposer)
              return true
            end
          end
        end
      end
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targetCards_ids = {}
    for _, move in ipairs(data) do
      if move.proposer and move.proposer ~= player and move.from and move.from == player and
          ((move.to and move.to ~= player) or (move.to == nil and move.toArea == Card.DiscardPile)) then
        for _, info in ipairs(move.moveInfo) do
          if info.fromArea == Card.PlayerEquip then
            table.insertIfNeed(targetCards_ids, info.cardId)
          end
        end
      end
    end
    local target_p = event:getCostData(self)
    local cids = room:askForCardChosen(player, target_p, "he", thbattle__ailisi_renoubaodan.name)
    room:throwCard(cids, thbattle__ailisi_renoubaodan.name, target_p, player)
    if cids and #targetCards_ids > 0 then
      for index, cid in ipairs(targetCards_ids) do
        if cid == cids then
          room:damage({
            from = player,
            to = event:getCostData(self),
            damage = 1,
            skillName = thbattle__ailisi_renoubaodan.name,
          })
        end
      end
    end
  end,
})



return thbattle__ailisi_renoubaodan